/*--------------------------------------------------------------------------------------------------
Yatak Operation System Project Copyright 2012
Author : Ilya Churaev
Started : 1 May 2012		Updated : 1 May 2012
File Name : math.c		Purpose : math library
--------------------------------------------------------------------------------------------------*/
#include <libc/math.h>

static unsigned long next = 1;

unsigned long long pow (unsigned long long num, unsigned long long p)
{
	//if (!p)
	//	return 1;
	//return num * pow (num, p-1);
	unsigned long long res = 1;
	int i = 0;
	for (i = 0; i < p; i++)
		res *= num;
	return res;
}

short rand (void)
{
	next = next * 1103515245L + 12345;
	return (short) (next >> 16) & 0x7fff;
}

void srand (unsigned short seed)
{
	next = seed;
}
